﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNet.NH;
using ConfOrm.NH;
using ConfOrm;
using PerformanceSystem2.Models;

namespace PerformanceSystem2.Core
{
    public class NaturalnessModuleMapping : IModuleMapping
    {
        #region Implementation of IModuleMapping
        
        public void DomainDefinition(ObjectRelationalMapper orm)
        {
            orm.TablePerClass<UserInfo>();
            orm.TablePerClass<Department>();
            orm.ManyToOne<UserInfo, Department>();
        }

        public void RegisterPatterns(Mapper mapper, IDomainInspector domainInspector)
        {
            throw new NotImplementedException();
        }

        public void Customize(Mapper mapper)
        {
            CustomizeRelations(mapper);
            CustomizeTables(mapper);
            CustomizeColumns(mapper);
        }

        public IEnumerable<Type> GetEntities()
        {
            return typeof(UserInfo).Assembly.GetTypes().Where(t => t.Namespace == typeof(UserInfo).Namespace);
        }

        #endregion

        private void CustomizeRelations(Mapper mapper)
        {

        }

        private void CustomizeColumns(Mapper mapper)
        {
        }

        private void CustomizeTables(Mapper mapper)
        {

        }
    }
}